#include  <stdio.h>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
int main()
{
    while(1)
    {
    time_t rawtime;
    struct tm * timeinfo;
    char buffer[80];
    time(&rawtime);
    timeinfo = localtime(&rawtime);
    strftime(buffer, sizeof(buffer),"%Y-%m-%d %H:%M:%S", timeinfo);
    printf("当前时间: %s\n", buffer);
    sleep(1); 
    system("clear"); //清屏
    }
    return 0;
}
